package org.codegallery.javagal.thread;

public class TwoThreads {
	public static void main(String[] args) {
		runThread1();
	}

	public static void runThread1() {
		Runnable r1 = new Runnable() {
			public void run() {
				try {
					while (true) {
						System.out.println("Hello, world!");
						Thread.sleep(1000L);
					}
				} catch (InterruptedException iex) {
				}
			}
		};

		Runnable r2 = new Runnable() {
			public void run() {
				try {
					while (true) {
						System.out.println("Goodbye, " + "cruel world!");
						Thread.sleep(2000L);
					}
				} catch (InterruptedException iex) {
				}
			}
		};

		new Thread(r1).start();
		new Thread(r2).start();
	}

	public static void runThread() {
		Thread thr = new Thread() {
			public void run() {

			}
		};
		thr.start();
	}
}
